/**
 * pharma-model - 9 janv. 2011 guillaume
 */
package org.bspv.pharma.model;

import java.io.Serializable;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Version;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;

import org.bspv.pharma.common.constant.Constants;

/**
 * @author guillaume
 */
@Entity
@Table(name = "KEY_VALUE")
public class KeyValue implements Serializable {

    /**
     * serialVersionUID.
     */
    private static final long serialVersionUID = 1L;

    /**
     * Identifiant de ce couple clé/valeur.
     */
    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    private Long id;
    /**
     * Clé.
     */
    @NotNull
    @Size(max = Constants.CONSTRAINT_CODE_SIZE)
    @Column(name = "_key")
    private String key;
    /**
     * Valeur.
     */
    @Size(max = Constants.CONSTRAINT_VALUE_SIZE)
    private String value;
    /**
     * Fourniture à laquelle se rapporte ce couple clé/valeur.
     */
    @NotNull
    @ManyToOne
    private Supply supply;
    /**
     * Numéro de version.
     */
    @Version
    private Integer version;

    /**
     * @return the id
     */
    public final Long getId() {
        return id;
    }

    /**
     * @param id
     *            the id to set
     */
    public final void setId(final Long id) {
        this.id = id;
    }

    /**
     * @return the key
     */
    public final String getKey() {
        return key;
    }

    /**
     * @param key
     *            the key to set
     */
    public final void setKey(final String key) {
        this.key = key;
    }

    /**
     * @return the value
     */
    public final String getValue() {
        return value;
    }

    /**
     * @param value
     *            the value to set
     */
    public final void setValue(final String value) {
        this.value = value;
    }

    /**
     * @return the supply
     */
    public final Supply getSupply() {
        return supply;
    }

    /**
     * @param supply
     *            the supply to set
     */
    public final void setSupply(final Supply supply) {
        this.supply = supply;
    }

    /**
     * @return the version
     */
    public final Integer getVersion() {
        return version;
    }

    /**
     * @param version
     *            the version to set
     */
    public final void setVersion(final Integer version) {
        this.version = version;
    }

}
